Support apps compiled against Jetpack Compose 1.10#5189
Support apps compiled against Jetpack Compose 1.10#5189
Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Internal Changes 🔧Deps
Other
🤖 This preview updates automatically when you update the PR. |
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f064536 | 327.04 ms | 405.35 ms | 78.31 ms |
| cf708bd | 408.35 ms | 458.98 ms | 50.63 ms |
| d15471f | 294.13 ms | 399.49 ms | 105.36 ms |
| 9fbb112 | 361.43 ms | 427.57 ms | 66.14 ms |
| 2387c2c | 317.04 ms | 354.60 ms | 37.56 ms |
| 806307f | 357.85 ms | 424.64 ms | 66.79 ms |
| b193867 | 331.08 ms | 397.06 ms | 65.98 ms |
| dc4cc7a | 361.10 ms | 439.53 ms | 78.43 ms |
| 694d587 | 379.62 ms | 400.80 ms | 21.18 ms |
| 17a0955 | 372.53 ms | 446.70 ms | 74.17 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f064536 | 1.58 MiB | 2.20 MiB | 633.90 KiB |
| cf708bd | 1.58 MiB | 2.11 MiB | 539.71 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| 2387c2c | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
| b193867 | 1.58 MiB | 2.19 MiB | 620.00 KiB |
| dc4cc7a | 1.58 MiB | 2.19 MiB | 619.28 KiB |
| 694d587 | 1.58 MiB | 2.19 MiB | 620.06 KiB |
| 17a0955 | 1.58 MiB | 2.10 MiB | 533.20 KiB |
Previous results on branch: markushi/fix/compose-110-api-changes
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a1de9cc | 314.30 ms | 357.84 ms | 43.54 ms |
| 82fc2e8 | 307.88 ms | 311.33 ms | 3.45 ms |
| 64b3ffa | 299.61 ms | 357.85 ms | 58.24 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a1de9cc | 0 B | 0 B | 0 B |
| 82fc2e8 | 0 B | 0 B | 0 B |
| 64b3ffa | 0 B | 0 B | 0 B |
Sentry Build Distribution
|
…sentry/sentry-java into markushi/fix/compose-110-api-changes
| ### Fixes | ||
|
|
||
| - Android: Remove the dependency on protobuf-lite for tombstones ([#5157](https://github.com/getsentry/sentry-java/pull/5157)) | ||
| - Support masking/unmasking and click/scroll detection for Jetpack Compose 1.10+ ([#5189](https://github.com/getsentry/sentry-java/pull/5189)) |
There was a problem hiding this comment.
- 🚫 The changelog entry seems to be part of an already released section
## 8.35.0.
Consider moving the entry to the## Unreleasedsection, please.
sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Click/scroll flags never reset between sibling nodes
- Added flag resets at the start of each in-bounds node examination to prevent incorrect gesture target detection across siblings.
Or push these changes by commenting:
@cursor push 98ce20ca72
Preview (98ce20ca72)
diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt
--- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt
+++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt
@@ -58,6 +58,8 @@
while (!queue.isEmpty()) {
val node = queue.poll() ?: continue
if (node.isPlaced && layoutNodeBoundsContain(rootLayoutNode, node, x, y)) {
+ isClickable = false
+ isScrollable = false
val modifiers = node.getModifierInfo()
for (index in modifiers.indices) {This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| // the last known tag when iterating the node tree | ||
| var lastKnownTag: String? = null | ||
| var isClickable = false | ||
| var isScrollable = false |
There was a problem hiding this comment.
Click/scroll flags never reset between sibling nodes
Medium Severity
Moving isClickable and isScrollable outside the while loop means they are never reset between nodes. Previously they were reset to false for each in-bounds node. Now, once any node sets isClickable = true, every subsequent in-bounds node with a tag will overwrite targetTag via targetTag = lastKnownTag, even if that node isn't clickable itself. This can cause the wrong element to be reported as the gesture target — e.g., a non-clickable sibling or child that merely has a tag could replace the correct clickable target.



📜 Description
Fixes #5086
Also fixes yet another issue with detecting scroll / click targets within Jetpack Compose.
Starting with Jetpack Compose 1.10, some internal APIs JVM methods dropped the
_release()suffix. E.g. the compiler now generatesLayoutNode.getChildren$ui()instead of previousLayoutNode.getChildren$ui_release().This PR wraps those methods and introduces a compat layer - so they work across multiple versions during runtime.
It required some "extra" gradle setup I'm not to happy about (as AGP does not seem to support different class paths per source set like we did for AGP), but it seems to work good enough.
androidx.compose.ui:ui:1.8.1replayhttps://sentry-sdks.sentry.io/explore/replays/82e1fa9ce34e44519d5ad48270ea8428
androidx.compose.ui:ui:1.10.5replayhttps://sentry-sdks.sentry.io/explore/replays/82d57734f9484b94910de015f301d766/
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps